PA 2: Using Data Visualization to Find the Penguins

Today you will be exploring different types of visualizations to uncover which species of penguins reside on different islands.

Some advice:

Groupwork Protocols

Insert blurb on how students are expected to collaborate.

Getting Set-up

Step 1: Install the palmerpenguins Package

We will be creating visualizations using the ggplot2 package.

For this activity, we will be exploring the penguins data from the palmerpenguins package, which has fantastic documentation with really awesome artwork. So, you will need to install the palmerpenguins package. Run the following code in your console:

install.packages("palmerpenguins")

Step 2: Create a Set-up Code Chunk

  1. Locate the code chunk at the beginning of your document (directly under the YAML).
  2. Name the code chunk setup (with the hashpipe #|)
  3. Specify the code chunk options (with the hashpipe #|) that the messages from loading in the packages should not be included.
  4. Load in the tidyverse or ggplot2 package.
  5. Load in the palmerpenguins package.

Step 3: Accessing the penguins Dataset

I like to tangibly see the data set I will be working with so let’s pull the penguins data into the R environment. Run the code below and you should see the penguins data appear in the top right Environment tab.

data(penguins)
Warning in data(penguins): data set 'penguins' not found

Step 4: Get to Know the Data

  1. What variables are included in these data? What units are the variables measured in? What does each row represent?

Making Graphics

In this section you will explore the penguins dataset by creating multiple types of plots. As you are creating you plots, please don’t forget to (1) give your plots reader friendly axes labels, and. (2) follow good code formatting!

Step 5: Barchart

Use ggplot2 to draw a barchart of different species included in the dataset.

Step 6: Scatterplot

Use ggplot2 to create a scatterplot of the relationship between the bill length (bill_length_mm) and bill depth (bill_depth_mm).

Step 7: Adding A Categorical Variable

Building off of the plot you made in Step 6, add an aesthetic to differentiate the species of the penguins in the scatterplot by color.

Step 8: Adding Another Categorical Variable

  1. Building off of the plot you made in Step 7, add the location of the penguins ( island) to your visualization. There may be more than one method to address this, however, one method will more easily allow you to address the questions below.

Canvas Quiz

Use the plots you created to address the following questions on Canvas:

  1. Which species of penguins is represented the least in the penguins data set?

  2. Which species of penguins are found on Biscoe Island?

  3. Which species of penguins are found on Dream Island?

  4. Which species of penguins are found on Torgersen Island?

  5. Color deficiencies can make differentiating groups difficult—what aesthetic could you add to your plot to double encode species?

Useful References